﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'up_tb_Vendor_Distribution_Transformers_Insert')
	DROP PROCEDURE up_tb_Vendor_Distribution_Transformers_Insert
GO


CREATE PROCEDURE [dbo].[up_tb_Vendor_Distribution_Transformers_Insert] 
(
	@Vendor_Distribution_PoleFk	int,
	@Latitude	float,
	@Longitude	float,
	@SerialNumber	nvarchar(100),
	@Comments	ntext,
	@CreatedDate datetime,

	@UtilityNumber nvarchar(100),
	@TransformerTypeFk int,
	@Manufacturer nvarchar(100),
	@Primary nvarchar(100),
	@Secondary nvarchar(100),
	@TypeFk int,
	@ClassFk int,
	@PhaseFk int,
	@Arrestor bit,
	@DualRated bit,
	@Pre1978 bit,
	@CutOut bit,
	@PCBTypeFk int,
	@ArrestorKv int,
	@CutOutKv int, 
	@PPM nvarchar(100),
	@TransformerNumber	nvarchar(100),
	@CanFk int,

	@DeterminedBy int = NULL,
	@TestNumber nvarchar(100) = NULL,
	@Impeddance nvarchar(100) = NULL,
	@Taps nvarchar(100) = NULL,
	@Polarity nvarchar(100) = NULL,
	@ManufDate datetime = NULL,
	@Sticker bit = 0	
)
AS
INSERT INTO tb_Vendor_Distribution_Transformers
(
	Vendor_Distribution_PoleFk,
	Latitude,
	Longitude,
	SerialNumber,
	Comments,
	CreatedDate,
	UtilityNumber,
	TransformerTypeFk,
	Manufacturer,
	[Primary],
	Secondary,
	TypeFk,
	ClassFk,
	PhaseFk ,
	Arrestor,
	DualRated,
	Pre1978,
	PCBTypeFk, 
	PPM,
	ArrestorKv,
	Cutout,
	CutoutKv,
	TransformerNumber,
	CanFk,
	DeterminedBy,
	TestNumber,
	Impeddance,
	Taps,
	Polarity,
	ManufDate,
	Sticker
)
VALUES
(
	@Vendor_Distribution_PoleFk,
	@Latitude,
	@Longitude,
	@SerialNumber,
	@Comments,
	@CreatedDate,
	@UtilityNumber,
	@TransformerTypeFk,
	@Manufacturer,
	@Primary,
	@Secondary,
	@TypeFk,
	@ClassFk,
	@PhaseFk,
	@Arrestor,
	@DualRated,
	@Pre1978,
	@PCBTypeFk, 
	@PPM,
	@ArrestorKv,
	@Cutout,
	@CutoutKv,
	@TransformerNumber,
	@CanFk,
	@DeterminedBy,
	@TestNumber, 
	@Impeddance, 
	@Taps, 
	@Polarity, 
	@ManufDate, 
	@Sticker
)

RETURN @@IDENTITY






